package br.com.android.watcher;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class CharacterInputActivity extends Activity implements OnClickListener {
	EditText editName;
	EditText editRealm;
	Button btOk;
	
	 @Override
	    protected void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	        setContentView(R.layout.input);

	        
	        btOk = (Button) findViewById(R.id.btOk);
	        editName = (EditText) findViewById(R.id.NameEdit);
	        editRealm = (EditText) findViewById(R.id.RealmEdit);
	        
	        btOk.setOnClickListener(this);
	        
	        //Log.v("Watcher Act","INPUT: Started Activity");

	    }
	 

	@Override
	public void onClick(View v) {
	   	 String name, realm;
    	 if(v.getId() == R.id.btOk){
    		name = this.editName.getText().toString().trim();
    		realm = this.editRealm.getText().toString().trim();
    		 
    		//Log.v("Watcher Act","INPUT: BtOk Pressed");
	        Intent resultIntent = new Intent();
	     
	        resultIntent.putExtra("name", name);
	        
	        resultIntent.putExtra("realm", realm);
	        //Log.v("Watcher Act","INPUT: Starting ResultIntent");
	        setResult(Activity.RESULT_OK, resultIntent);
	        finish();
    	 	}
		
	}
}
